package com.duan.common.exceptions;

import com.duan.common.enums.ResponseENUM;
import lombok.Getter;

/**
 *
 * 业务统一异常
 * Created by duanlsh on 18/6/20.
 */
@Getter
public class ServiceException extends RuntimeException {

    private Integer code;
    private String message;

    private ServiceException() {
        super();
    }

    public ServiceException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public ServiceException(int code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.message = message;
    }

    public ServiceException(String message, Throwable cause) {
        this(ResponseENUM.FAIL.getCode(), message, cause);
    }


    public ServiceException(String message) {
        this(message, null);
    }

    public ServiceException(Throwable cause) {
        super(cause);
    }

}
